package cn.good.biz.controller;

import cn.good.biz.service.GDDictionariesService;
import cn.good.dto.Dto;
import cn.good.dto.DtoUtil;
import cn.good.pojo.Desk;
import cn.good.pojo.ServiceType;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import javax.annotation.Resource;

@RestController
@RequestMapping("/doc/dictionaries")
public class DictionariesController {

    @Resource
    private GDDictionariesService gdDictionariesService;
    @ApiOperation(value="查询科室列表",httpMethod = "POST",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class,notes="查询科室列表")
    @RequestMapping("/deskList")
    public Dto deskDictionaries(Integer superiorId){

        try {
            List<Desk> list = gdDictionariesService.searchDeskList(superiorId);
            return DtoUtil.returnDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return DtoUtil.returnFail("查询失败","10007");

        }
    }
    @ApiOperation(value="查询服务列表",httpMethod = "POST",
            protocols = "HTTP", produces = "application/json",
            response = Dto.class,notes="查询服务列表")
    @RequestMapping("/serviceList")
    public Dto serviceTypeList(){
        try {
            List<ServiceType> list = gdDictionariesService.searchServiceList();
            return DtoUtil.returnDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return DtoUtil.returnFail("查询失败","10007");
        }
    }

}
